package com.chandra.pos.employee.dao.entity;

import com.chandra.pos.employee.model.UserStatusType;
import com.chandra.pos.model.PosEntity;

import javax.persistence.*;
import java.util.Date;

/**
 * Created with IntelliJ IDEA.
 * Customer: Admin
 * Date: 11/15/13
 * Time: 12:40 PM
 * To change this template use File | Settings | File Templates.
 */
@Entity
@Table(name="SYSTEM_USERS")
public class Employee extends PosEntity {


    @Column(name="FIRST_NAME", unique = false, nullable = false)
    private String firstName;

    @Column(name="LAST_NAME", unique = false, nullable = false)
    private String lastName;

    @Column(name="USER_NAME", unique = false, nullable = false)
    private String userName;

    @Column(name="PASSWORD", unique = false, nullable = false)
    private String password;

    @Column(name="CITY", unique = false, nullable = false)
    private String city;

    @Column(name="ADDRESS", unique = false, nullable = true)
    private String address;

    @Column(name="EMAIL", unique = false, nullable = true)
    private String email;

    @Column(name="PRIMARY_CONTACT", unique = false, nullable = true)
    private String primaryContact;

    @Column(name="SECONDARY_CONTACT", unique = false, nullable = true)
    private String secondaryContact;

    @Column(name="LAST_LOGIN", unique = false, nullable = true)
    private Date lastLogin;

    @Column(name="ACCOUNT_EXPIRY_DATE", unique = false, nullable = true)
    private Date expiryDate;


    @Enumerated(EnumType.ORDINAL)
    @Column(name = "STATUS_ID", updatable = true, insertable = true, nullable = false)
    private UserStatusType accountStatus;

    public Date getExpiryDate() {
        return expiryDate;
    }

    public void setExpiryDate(Date expiryDate) {
        this.expiryDate = expiryDate;
    }

    public String getFirstName() {
        return firstName;
    }

    public void setFirstName(String firstName) {
        this.firstName = firstName;
    }

    public UserStatusType getAccountStatus() {
        return accountStatus;
    }

    public void setAccountStatus(UserStatusType accountStatus) {
        this.accountStatus = accountStatus;
    }

    public Date getLastLogin() {
        return lastLogin;
    }

    public void setLastLogin(Date lastLogin) {
        this.lastLogin = lastLogin;
    }

    public String getAddress() {
        return address;
    }

    public void setAddress(String address) {
        this.address = address;
    }

    public String getCity() {
        return city;
    }

    public void setCity(String city) {
        this.city = city;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public String getUserName() {
        return userName;
    }

    public void setUserName(String userName) {
        this.userName = userName;
    }

    public String getLastName() {
        return lastName;
    }

    public void setLastName(String lastName) {
        this.lastName = lastName;
    }

    public String getPrimaryContact() {
        return primaryContact;
    }

    public void setPrimaryContact(String primaryContact) {
        this.primaryContact = primaryContact;
    }

    public String getSecondaryContact() {
        return secondaryContact;
    }

    public void setSecondaryContact(String secondaryContact) {
        this.secondaryContact = secondaryContact;
    }

    public String getEmail() {
        return email;
    }

    public void setEmail(String email) {
        this.email = email;
    }

    @Transient
    public String getName(){
        StringBuffer strBuff = new StringBuffer();

        strBuff.append(" ").append(getFirstName());
        strBuff.append(" ").append(getLastName());

        return strBuff.toString();

    }
}
